#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <queue> 
typedef long long int  LL;
using namespace std;
int main(){
//	ios_base::sync_with_stdio(0);
//	cin.tie(0);
	LL t,n,m,x;
	cin>>t;
	while(t--){
		priority_queue < LL,vector<LL>,less<LL> > p;
		priority_queue < LL,vector<LL>,less<LL> > q;
		cin>>n>>m;
		while(n--){
			cin>>x;
			p.push(x);
		}
		while(m--){
			cin>>x;
			q.push(x);
		}
		bool judge=1;
		while(!p.empty()&&judge){
			LL t1=p.top();
			p.pop();
			while(!q.empty()&&judge){
				LL t2=q.top();
				q.pop();
				LL t=t2-t1;
				if(t>0)	q.push(t);
				else if(t==0)	break;
				else	judge=0;
				break;
			}
		}
		if(judge)	cout<<"Yes"<<endl;
		else	cout<<"No"<<endl;
	}
	return 0;
}

